package com.rou.im.boot.starter.server.netty.config;

import io.netty.handler.logging.LogLevel;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.context.annotation.Configuration;

/**
 * <p></p>
 *
 * @author GaoShuangWen
 * @since 2020-05-03 23:01
 */
@Data
@ConfigurationProperties(prefix = "netty")
public class NettyConfigProperties {

    @NestedConfigurationProperty
    private LoopGroup loopGroup = new LoopGroup();

    @NestedConfigurationProperty
    private Option option = new Option();

    @NestedConfigurationProperty
    private Server server = new Server();

    @NestedConfigurationProperty
    private Handler handler = new Handler();




    @Data
    public static class LoopGroup {
        private int bossCount = 1;
        private String bossThreadName ;
        private int workerCount;
        private String workerThreadName ;
    }

    @Data
    public static class Option {

        private boolean keepAlive;

        private int backlog;
    }

    @Data
    public static class Server {

        private int port = 8899;

        private String ioType = "nio";
    }
    @Data
    public static class Handler {

        private LogLevel logLevel;
    }
}
